import com.hope.pojo.Student;
import com.hope.pojo.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.testng.annotations.Test;

public class    Mytest {
    public static void main(String[] args) {
        ApplicationContext Context = new ClassPathXmlApplicationContext("beans.xml");
        Student student = (Student) Context.getBean("student");
        System.out.println(student.toString());



        /*
        Student{name='蔡江鸿',
         address='Address{address='厦门'}',
         book=[红楼梦, 水浒传, 三国演义],
         hobbies=[听歌, 跳舞],
          card={身份证=12142142152131231, 银行卡=12321392813912833},
          games=[LOL, BOB],
           wife='null',
           info={password=root, 学号=21303206, username=root, 性别=男}}

         */


    }

    @Test
    public void test2(){
        ApplicationContext Context = new ClassPathXmlApplicationContext("userbeans.xml");
        User user =  Context.getBean("user2", User.class);
        System.out.println(user);
        User user1 =  Context.getBean("user2", User.class);
        System.out.println(user1);
        System.out.println(user.hashCode());
        System.out.println(user1.hashCode());
        System.out.println(user==user1);
    }

}
